]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: provide a consistent way to refer to panel items from lg
authorDan Winship <danw@gnome.org>
Wed, 6 Apr 2011 13:26:15 +0000 (09:26 -0400)
committerDan Winship <danw@gnome.org>
Tue, 26 Apr 2011 12:21:41 +0000 (08:21 -0400)
Rename a few Panel fields and add a _statusArea object pointing to the
status area PanelButton objects. You can now address each item
consistently from lg:

    Main.panel._activities
    Main.panel._appMenu
    Main.panel._dateMenu
    Main.panel._statusArea.a11y
    Main.panel._statusArea.volume ...
    Main.panel._userMenu

https://bugzilla.gnome.org/show_bug.cgi?id=646915

js/ui/panel.js

index 74183a0e559d13a87e5c15ced30c9633e0832b45..dc97813a0c370b3542afc52ab65da29f79432aa9 100644 (file)
@@ -817,6 +817,8 @@ Panel.prototype = {
                                         reactive: true });
         this.actor._delegate = this;
 
+        this._statusArea = {};
+
         Main.overview.connect('shown', Lang.bind(this, function () {
             this.actor.add_style_class_name('in-overview');
         }));
@@ -913,6 +915,7 @@ Panel.prototype = {
                                       style_class: 'panel-button',
                                       reactive: true,
                                       can_focus: true });
+        this._activities = this.button;
         this.button.set_child(label);
         this.button._delegate = this.button;
         this.button._xdndTimeOut = 0;
@@ -941,10 +944,10 @@ Panel.prototype = {
 
         this._hotCorner = null;
 
-        let appMenuButton = new AppMenuButton();
-        this._leftBox.add(appMenuButton.actor);
+        this._appMenu = new AppMenuButton();
+        this._leftBox.add(this._appMenu.actor);
 
-        this._menus.addMenu(appMenuButton.menu);
+        this._menus.addMenu(this._appMenu.menu);
 
         /* center */
         this._dateMenu = new DateMenu.DateMenuButton();
@@ -963,12 +966,12 @@ Panel.prototype = {
         this._rightBox.add(this._trayBox);
         this._rightBox.add(this._statusBox);
 
-        this._statusmenu = new StatusMenu.StatusMenuButton();
-        this._statusmenu.actor.name = 'panelStatus';
-        this._rightBox.add(this._statusmenu.actor);
+        this._userMenu = new StatusMenu.StatusMenuButton();
+        this._userMenu.actor.name = 'panelStatus';
+        this._rightBox.add(this._userMenu.actor);
 
         // Synchronize the buttons pseudo classes with its corner
-        this._statusmenu.actor.connect('style-changed', Lang.bind(this,
+        this._userMenu.actor.connect('style-changed', Lang.bind(this,
             function(actor) {
                 let rtl = actor.get_direction() == St.TextDirection.RTL;
                 let corner = rtl ? this._leftCorner : this._rightCorner;
@@ -1051,11 +1054,13 @@ Panel.prototype = {
             let indicator = new constructor();
             this._statusBox.add(indicator.actor);
             this._menus.addMenu(indicator.menu);
+
+            this._statusArea[role] = indicator;
         }
 
         // PopupMenuManager depends on menus being added in order for
         // keyboard navigation
-        this._menus.addMenu(this._statusmenu.menu);
+        this._menus.addMenu(this._userMenu.menu);
     },
 
     startupAnimation: function() {